﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace CloneOutRefBoxing
{
    enum Specialties
    {
        Mathematics,
        Informatics,
        ComputerScience,
        Iconomics,
        Business,
        Geography,
        Animals
    }
    enum Universities
    {
        SofiaUniversity,
        TechnicalUniversity,
        UNSS
    }
    enum Faculties
    {
        Fmi,
        Biological,
        Iconomical
    }

    class Student : ICloneable, IComparable<Student>
    {
        private string firstName;
        private string middleName;
        private string lastName;
        private int sSN;
        private string address;
        private string phone;
        private string mail;
        private string course;
        private Specialties specialties;
        private Universities universities;
        private Faculties faculties;

        public string FirstName
        {
            get
            {
                return firstName;
            }
            set
            {
                firstName = value;
            }
        }

        public string MiddleName
        {
            get
            {
                return middleName;
            }
            set
            {
                middleName = value;
            }
        }

        public string LastName
        {
            get
            {
                return lastName;
            }
            set
            {
                lastName = value;
            }
        }

        public int SSN
        {
            get
            {
                return sSN;
            }
            set
            {
                sSN = value;
            }
        }

        public string Address
        {
            get
            {
                return address;
            }
            set
            {
                address = value;
            }
        }

        public string Phone
        {
            get
            {
                return phone;
            }
            set
            {
                phone = value;
            }
        }

        public string Mail
        {
            get
            {
                return mail;
            }
            set
            {
                mail = value;
            }
        }

        public string Course
        {
            get
            {
                return course;
            }
            set
            {
                course = value;
            }
        }

        public Specialties Specialties
        {
            get
            {
                return specialties;
            }
            set
            {
                specialties = value;
            }
        }

        public Universities Universities
        {
            get
            {
                return universities;
            }
            set
            {
                universities = value;
            }
        }

        public Faculties Faculties
        {
            get
            {
                return faculties;
            }
            set
            {
                faculties = value;
            }
        }

        public Student(string firstName, string middleName, string lastName, int sSN, string address, string phone, string mail, string course, Specialties specialties, Universities universities, Faculties faculties)
        {
            this.firstName = firstName;
            this.middleName = middleName;
            this.lastName = lastName;
            this.sSN = sSN;
            this.address = address;
            this.phone = phone;
            this.mail = mail;
            this.course = course;
            this.specialties = specialties;
            this.universities = universities;
            this.faculties = faculties;
        }

        public override bool Equals(object obj)
        {
            Student student = obj as Student;
            // Check if we have valid not null Student object
            if (student == null)
                return false;
            if (!Object.Equals(this.firstName, student.firstName))
                return false;
            if (!Object.Equals(this.middleName, student.middleName))
                return false;
            if (!Object.Equals(this.lastName, student.lastName))
                return false;
            if (this.sSN != student.sSN)
                return false;
            if (!Object.Equals(this.address, student.address))
                return false;
            if (!Object.Equals(this.phone, student.phone))
                return false;
            if (!Object.Equals(this.mail, student.mail))
                return false;
            if (!Object.Equals(this.course, student.course))
                return false;
            if (this.specialties != student.specialties)
                return false;
            if (this.universities != student.universities)
                return false;
            if (this.faculties != student.faculties)
                return false;
            return true;

        }
        public override int GetHashCode()
        {
            return firstName.GetHashCode() ^ middleName.GetHashCode() ^ lastName.GetHashCode() ^ 
                sSN.GetHashCode() ^ address.GetHashCode() ^
                phone.GetHashCode() ^ mail.GetHashCode() ^ course.GetHashCode()^
               specialties.GetHashCode() ^ universities.GetHashCode() ^ faculties.GetHashCode();
        }

        public static bool operator ==(Student student1,
                               Student student2)
        {
            return Student.Equals
                (student1, student2);
        }
        public static bool operator !=(Student student1,
            Student student2)
        {
            return !(Student.Equals(student1, student2));
        }

        public override string ToString()
        {
            return "Name: " + firstName+ " " + middleName +" "+ lastName + "  ssn: " + sSN + " address: " + address +" phone: " + phone +
              " mail: " + mail + " faculty: " + faculties + " university: " + universities + " specialty: " + specialties;
        }

        public object Clone()
        {
            return new Student(this.firstName, this.middleName, this.lastName,this.sSN, this.address, this.phone, this.mail, this.course, this.specialties, this.universities, this.faculties);
        }

        public int CompareTo(Student student)
        {
            if (this.firstName != student.firstName)
            {
                return this.firstName.CompareTo(student.firstName);
            }
            if (this.sSN != student.sSN)
            {
                return (this.sSN - student.sSN);
            }
            return 0;
        }


    }
}
